<template>
  <view class="container screem-width">
    <VBar :datatab="tabList" @tab="handleChange" />
    <scroll-view class="list" :scroll-y="true" @scrolltolower="fetchData()">
      <block v-if="current === 0">
        <view v-for="(item, index) in list" :key="index" class="person-list">
          <view class="flex flex-end">
            <view 
              class="status-btn" 
              :class="item.status === 2?'not-start':(item.status===3?'ending':'')"
              >{{ item.status===1?'进行中':(item.status===2?'未开始':'已结束') }}</view>
          </view>
          <view class="flex items-middle space-between list-item" @click="toDetail(item)">
            <view class="person-info">
              <view class="name">{{ item.title }}</view>
              <view class="company">开始时间：{{ item.beginDate }}</view>
              <view class="company">结束时间：{{ item.endDate }}</view>
            </view>
            <u-icon name="arrow-right" color="#1678FF" />
          </view>
          <view class="flex items-middle flex-end fun-box">
            <VIcon class="icon" type="icon-bianji" color="#333333" size="38" @click="toEdit(item)"/>
            <VIcon class="icon" type="icon-erweima" color="#333333" size="34" @click="toCode(item)"/>
            <VIcon class="icon" type="icon-renyuan-" color="#333333" size="38" @click="toPerson(item)"/>
            <VIcon class="icon" type="icon-shanchu" color="#333333" size="38" @click="toDelete(item)"/> 
          </view>
        </view>
        <view class="add-btn screen-width" @tap="createActive">创建活动</view>
      </block>
      <block v-else>
        <view v-for="(item, index) in list" :key="index" class="person-list">
          <view class="flex items-middle space-between list-item" @click="toDetail(item)">
            <view class="person-info">
              <view class="name">{{ item.title }}</view>
              <view class="company">开始时间：{{ item.beginDate }}</view>
              <view class="company">结束时间：{{ item.endDate }}</view>
            </view>
            <u-icon name="arrow-right" color="#1678FF" />
          </view>
        </view>
      </block>
      <van-divider v-if="list.length && total < total + 1" content-position="center">我也是有底线的</van-divider>
      <van-divider v-if="!list.length" content-position="center">暂无数据</van-divider>
    </scroll-view>
    <view v-if="!list.length && current === 0" class="content-info">
      <image mode="widthFix" :src="$imgUrl + 'static/activity-introduce.png'" />
    </view>
  </view>
</template>

<script src="./index.js"></script>
<style lang="less" scoped src="./index.less"></style>